﻿' Copyright (c) Microsoft Corporation. All rights reserved.

Imports System

Imports System.Security.Permissions

Imports System.ServiceModel
Imports System.ServiceModel.Channels

Namespace Microsoft.Samples.WS2007FederationHttpBinding
    Class Client
        Shared Sub Main(ByVal args As String())
            Dim clientFactory As New ChannelFactory(Of ICalculator)("ServiceFed")
            Dim client As ICalculator = clientFactory.CreateChannel()

            ' Call the Add service operation.
            Dim value1 As Double = 100
            Dim value2 As Double = 15.99
            Dim result As Double = client.Add(value1, value2)
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result)

            ' Call the Subtract service operation.
            value1 = 145
            value2 = 76.54
            result = client.Subtract(value1, value2)
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result)

            ' Call the Multiply service operation.
            value1 = 9
            value2 = 81.25
            result = client.Multiply(value1, value2)
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result)

            ' Call the Divide service operation.
            value1 = 22
            value2 = 7
            result = client.Divide(value1, value2)
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result)

            'Closing the client gracefully closes the connection and cleans up resources
            DirectCast(client, IChannel).Close()

            Console.WriteLine()
            Console.WriteLine("Press <ENTER> to terminate client.")
            Console.ReadLine()
        End Sub
    End Class
End Namespace
